package com.example.husbandry_online.service;


import com.example.husbandry_online.model.User;
import com.example.husbandry_online.retrofit.ResponseModel;

import java.util.Observable;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface UserService {
    //发送验证码
    @GET("send/message")
    Call<ResponseModel<String>> sendCode(@Query("telephone") String telephone);

    //注册
    @POST("register")
    Call<ResponseModel<User>> registry(@Body User user);
    //@Field("username") String username, @Field("telephone") String telephone, @Field("password")String password,@Field("code")String code

    //登录
    @POST("login")
    Call<ResponseModel<User>> login(@Body User user);

    //忘记密码，给已注册的手机号发送短信
    @POST("send/message/exist")
    @FormUrlEncoded
    Call<ResponseModel<String>> sendCodeToExistPhone(@Field("telephone") String telephone);

    @FormUrlEncoded
    @POST("reset/password")
    Call<ResponseModel<String>> forgetAndChangePwd(@Field("telephone") String telephone,@Field("password")String password);
}
